package week2;

public class Ex12 {
    public static void main(String[] args) {
        int i = 0, sum = 0, count = 0;
        while (true) {
            ++i;
            sum += i;
            int j;
            int a = (int)Math.sqrt(sum);
            for (j = 1; j < a; ++j){
                if (sum % j == 0)
                    count++;
            }
            count *= 2;
            if (sum % a == 0) count++;
            if (count >= 500){
                System.out.println(sum);
                break;
            }
            count = 0;
        }
    }
}
